//
//  CategporyViewController.m
//  DanTang
//
//  Created by honeyrr on 2017/9/4.
//  Copyright © 2017年 honeyrr. All rights reserved.
//

#import "CategporyViewController.h"
#import "SearchCateViewController.h"
#import "CateTopViewController.h"
#import "DTClassBottomView.h"
#import "CateTableViewController.h"

@interface CategporyViewController ()<DTClassBottomViewDelegate>

@end

@implementation CategporyViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"Feed_SearchBtn_18x18_"] style:UIBarButtonItemStylePlain target:self action:@selector(searchClick)];
    self.view.backgroundColor = [UIColor groupTableViewBackgroundColor];
    [self setUpScrollView];
}

//设置分类布局的调用
-(void) setUpScrollView
{
    UIScrollView *scrollView = [[UIScrollView alloc]init];
    scrollView.frame = CGRectMake(0, 0, DTScreenW, DTScreenH);
    
    [self.view addSubview:scrollView];
    
    CateTopViewController *topVC = [[CateTopViewController alloc]init];
    [self addChildViewController:topVC];
    topVC.view.frame = CGRectMake(0, 0, DTScreenW, 140);
    [scrollView addSubview:topVC.view];
    
    DTClassBottomView *btmView = [[DTClassBottomView alloc]init];
    btmView.backgroundColor = [UIColor whiteColor];
    [scrollView addSubview:btmView];
    btmView.frame = CGRectMake(0, CGRectGetMaxY(topVC.view.frame) + 10, DTScreenW, DTScreenH - 150);
    btmView.delegate = self;
    
    scrollView.contentSize = CGSizeMake(DTScreenW, CGRectGetMaxY(btmView.frame));
}

-(void)groupButtonItemClick:(UIButton *)btn
{
    NSInteger _id = btn.tag;
    
    CateTableViewController *tvc = [[CateTableViewController alloc]init];
    tvc.type = @"风格品类";
    tvc._id = _id;
    tvc.title = btn.titleLabel.text;
    [self.navigationController pushViewController:tvc animated:YES];
}

-(void) searchClick
{
    [self.navigationController pushViewController:[SearchCateViewController new] animated:YES];
}

@end
